package com.m.pojo;

public class Person implements  Comparable<Person>{
    public String name;
    public Double high;
    protected int age;
    private static int count;


    public static int getCount() {
        return count;
    }

    public Person() {
        count++;
    }

    public Person(String name, int age) {
        count++;
        this.name = name;
        this.age = age;
    }

    public Person(String name, Double high, int age) {
        count++;
        this.name = name;
        this.high = high;
        this.age = age;
    }

    private Person(String name) {
        count++;
        this.name = name;
    }

    public Double getHigh() {
        return high;
    }

    public void setHigh(Double high) {
        this.high = high;
    }

    public void setAge(int age) {
        if (age < 0 || age > 120) {
            throw new IllegalArgumentException("Age must be between 0 and 120");
        }
        this.age = age;
    }
    public int getAge() {
        return age;
    }
    public void setName(String name) {
        this.name = name;
    }

    public void setName(String name1, String name2) {
        this.name = name1.concat(" " + name2);
    }
    public String getName() {
        return this.name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", high=" + high +
                ", age=" + age +
                '}';
    }

    public String hello() {
        return "Person:hello";
    }

    @Override
    public int compareTo(Person o) {
        return o.high.compareTo(this.high);
    }

}
